<template>
  <div>
    <p>List页面-嵌套式路由</p>
    <p>id：{{id}}</p>
  </div>
</template>

<script>
export default {
  name: "List",
  props: {
    id: {
      type: String,
      default: ""
    }
  },
  data() {
    return {
      crumbData: null
    };
  },
  watch: {
    $route: {
      handler(route) {
        console.log(this.$route.matched);
        this.crumbData = this.$route.matched.map(m => m.name || m.redirect);
        console.log(this.crumbData);
      },
      immediate: true // 这⼀⾏要加上，让它⼀开始执⾏⼀次
    }
  }
};
</script>
